﻿/********************************************************************************
     File:																
            Manager.aspx.cs                         
     Description:
            来信办理管理
     Author:									
            DDBuildTools
            http://DDBuildTools.supesoft.com
     Finish DateTime:
            2013/4/1 12:21:45
     History:
*********************************************************************************/
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Model;
using Model.Components;
using FrameWork;
using FrameWork.Components;
using FrameWork.WebControls;

namespace Model.Web.Module.Model.T_TouSu
{
    public partial class Manager : System.Web.UI.Page
    {
        Int32 IDX = (Int32)Common.sink("IDX", MethodType.Get, 10, 0, DataType.Int);
        string CMD = (string)Common.sink("CMD", MethodType.Get, 10, 1, DataType.Str);
        protected void Page_Load(object sender, EventArgs e)
        {
            FrameWorkPermission.CheckPagePermission(CMD);
            if (!Page.IsPostBack)
            {
                OnStart();
            }
        }
        
        /// <summary>
        /// 开始操作
        /// </summary>
        private void OnStart()
        {
            T_TouSuEntity ut = BusinessFacadeModel.T_TouSuDisp(IDX);
            OnStartData(ut);
            switch (CMD)
            { 
                case "New":
                    TabOptionItem1.Tab_Name = HeadMenuWebControls1.HeadOPTxt = "增加";
                    Hidden_Disp();
                    break;
                case "List":
                    TabOptionItem1.Tab_Name = HeadMenuWebControls1.HeadOPTxt = "查看";
                    Hidden_Input();
                    Button1.Visible = false;
                    AddEditButton();
                    break;
                case "Edit":
                    TabOptionItem1.Tab_Name = HeadMenuWebControls1.HeadOPTxt = "修改";
                    Hidden_Disp();
                    AddDeleteButton();
                    break;
                case "Delete":
                    ut.DataTable_Action_ = DataTable_Action.Delete;
                    if (BusinessFacadeModel.T_TouSuInsertUpdateDelete(ut) > 0)
                    {
                        EventMessage.MessageBox(1, "删除成功", string.Format("删除ID:{0}成功!", IDX), Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
                    }
                    else {
                        EventMessage.MessageBox(1, "删除失败", string.Format("删除ID:{0}失败!", IDX), Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
                    }
                    break;
                default :
                    EventMessage.MessageBox(2, "不存在操作字符串!", "不存在操作字符串!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
                    break;
            }
        }

        /// <summary>
        /// 增加修改按钮
        /// </summary>
        private void AddEditButton()
        {
            HeadMenuButtonItem bi = new HeadMenuButtonItem();
            bi.ButtonPopedom = PopedomType.Edit;
            bi.ButtonName = "来信办理";
            bi.ButtonUrl = string.Format("?CMD=Edit&IDX={0}", IDX);
            HeadMenuWebControls1.ButtonList.Add(bi);
        }


        /// <summary>
        /// 增加删除按钮
        /// </summary>
        private void AddDeleteButton()
        {
            HeadMenuButtonItem bi = new HeadMenuButtonItem();
            bi.ButtonPopedom = PopedomType.Delete;
            bi.ButtonName = "来信办理";
            bi.ButtonUrlType = UrlType.JavaScript;
            bi.ButtonUrl = string.Format("DelData('?CMD=Delete&IDX={0}')", IDX);
            HeadMenuWebControls1.ButtonList.Add(bi);

            HeadMenuButtonItem bi1 = new HeadMenuButtonItem();
            bi1.ButtonPopedom = PopedomType.List;
            bi1.ButtonIcon = "back.gif";
            bi1.ButtonName = "返回";
            bi1.ButtonUrl = string.Format("?CMD=List&IDX={0}", IDX);
            HeadMenuWebControls1.ButtonList.Add(bi1);
        }

        /// <summary>
        /// 初始化数据
        /// </summary>
        /// <param name="ut"></param>
        private void OnStartData(T_TouSuEntity ut)
        {
        
                TID_Input.Text = TID_Disp.Text = ut.TID.ToString();
                ALaiyuan_Input.Text = ALaiyuan_Disp.Text = ut.ALaiyuan.ToString();
                AzhuanbanID_Input.Text = AzhuanbanID_Disp.Text = ut.AzhuanbanID.ToString();
                AzhuanfangTime_Input.Text = AzhuanfangTime_Disp.Text = ut.AzhuanfangTime.ToString();
                ALiFangname_Input.Text = ALiFangname_Disp.Text = ut.ALiFangname.ToString();
                ALaifangTime_Input.Text = ALaifangTime_Disp.Text = ut.ALaifangTime.ToString();
                AID_Input.Text = AID_Disp.Text = ut.AID.ToString();
                APhone_Input.Text = APhone_Disp.Text = ut.APhone.ToString();
                AlaifangGroup_Input.Text = AlaifangGroup_Disp.Text = ut.AlaifangGroup.ToString();
                Alaifangzhuzhi_Input.Text = Alaifangzhuzhi_Disp.Text = ut.Alaifangzhuzhi.ToString();
                Alaifangpostcode_Input.Text = Alaifangpostcode_Disp.Text = ut.Alaifangpostcode.ToString();
                Abeitousudanw_Input.Text = Abeitousudanw_Disp.Text = ut.Abeitousudanw.ToString();
                AbeitousuName_Input.Text = AbeitousuName_Disp.Text = ut.AbeitousuName.ToString();
                Afanyingwenti_Input.Text = Afanyingwenti_Disp.Text = ut.Afanyingwenti.ToString();
                AdiyiciTime_Input.Text = AdiyiciTime_Disp.Text = ut.AdiyiciTime.ToString();
                Asunshi_Input.Text = Asunshi_Disp.Text = ut.Asunshi.ToString();
                Azhinengbumen_Input.Text = Azhinengbumen_Disp.Text = ut.Azhinengbumen.ToString();
                ATimeAndGroup_Input.Text = ATimeAndGroup_Disp.Text = ut.ATimeAndGroup.ToString();
                AfanyingTime_Input.Text = AfanyingTime_Disp.Text = ut.AfanyingTime.ToString();
                Achuliqingkuang_Input.Text = Achuliqingkuang_Disp.Text = ut.Achuliqingkuang.ToString();
                ADafu_Input.Text = ADafu_Disp.Text = ut.ADafu.ToString();
                AShenqingfucha_Input.Text = AShenqingfucha_Disp.Text = ut.AShenqingfucha.ToString();
                AfuchaTime_Input.Text = AfuchaTime_Disp.Text = ut.AfuchaTime.ToString();
                AShiyijian_Input.Text = AShiyijian_Disp.Text = ut.AShiyijian.ToString();
                Axinfangbanyijian_Input.Text = Axinfangbanyijian_Disp.Text = ut.Axinfangbanyijian.ToString();
                AlingdaoYijian_Input.Text = AlingdaoYijian_Disp.Text = ut.AlingdaoYijian.ToString();
                Azhuanchu_Input.Text = Azhuanchu_Disp.Text = ut.Azhuanchu.ToString();
                AzhuanchuTime_Input.Text = AzhuanchuTime_Disp.Text = ut.AzhuanchuTime.ToString();
                AyaoqiuTime_Input.Text = AyaoqiuTime_Disp.Text = ut.AyaoqiuTime.ToString();
                Ajieguo_Input.Text = Ajieguo_Disp.Text = ut.Ajieguo.ToString();
                Ajiluren_Input.Text = Ajiluren_Disp.Text = ut.Ajiluren.ToString();
                AjilushiTime_Input.Text = AjilushiTime_Disp.Text = ut.AjilushiTime.ToString();
                Afujian_Input.Text = Afujian_Disp.Text = ut.Afujian.ToString();
                BWentiType_Input.Text = BWentiType_Disp.Text = ut.BWentiType.ToString();
                BXianCon_Input.Text = BXianCon_Disp.Text = ut.BXianCon.ToString();
                BXinfang_Input.Text = BXinfang_Disp.Text = ut.BXinfang.ToString();
                BLingdao_Input.Text = BLingdao_Disp.Text = ut.BLingdao.ToString();
                BSumDay_Input.Text = BSumDay_Disp.Text = ut.BSumDay.ToString();
            
                BChuliGroup_Input.Text = BChuliGroup_Disp.Text = ut.BChuliGroup.ToString();
                BChaoSong_Input.Text = BChaoSong_Disp.Text = ut.BChaoSong.ToString();
                BXieban_Input.Text = BXieban_Disp.Text = ut.BXieban.ToString();
                BIF_Input.Text = BIF_Disp.Text = ut.BIF.ToString();
              
                
        }

        /// <summary>
        /// 隐藏输入框
        /// </summary>
        private void Hidden_Input()
        { 
        TID_Input.Visible = false;
        ALaiyuan_Input.Visible = false;
        AzhuanbanID_Input.Visible = false;
        AzhuanfangTime_Input.Visible = false;
        ALiFangname_Input.Visible = false;
        ALaifangTime_Input.Visible = false;
        AID_Input.Visible = false;
        APhone_Input.Visible = false;
        AlaifangGroup_Input.Visible = false;
        Alaifangzhuzhi_Input.Visible = false;
        Alaifangpostcode_Input.Visible = false;
        Abeitousudanw_Input.Visible = false;
        AbeitousuName_Input.Visible = false;
        Afanyingwenti_Input.Visible = false;
        AdiyiciTime_Input.Visible = false;
        Asunshi_Input.Visible = false;
        Azhinengbumen_Input.Visible = false;
        ATimeAndGroup_Input.Visible = false;
        AfanyingTime_Input.Visible = false;
        Achuliqingkuang_Input.Visible = false;
        ADafu_Input.Visible = false;
        AShenqingfucha_Input.Visible = false;
        AfuchaTime_Input.Visible = false;
        AShiyijian_Input.Visible = false;
        Axinfangbanyijian_Input.Visible = false;
        AlingdaoYijian_Input.Visible = false;
        Azhuanchu_Input.Visible = false;
        AzhuanchuTime_Input.Visible = false;
        AyaoqiuTime_Input.Visible = false;
        Ajieguo_Input.Visible = false;
        Ajiluren_Input.Visible = false;
        AjilushiTime_Input.Visible = false;
        Afujian_Input.Visible = false;
        BWentiType_Input.Visible = false;
        BXianCon_Input.Visible = false;
        BXinfang_Input.Visible = false;
        BLingdao_Input.Visible = false;
        BSumDay_Input.Visible = false; 
        BChuliGroup_Input.Visible = false;
        BChaoSong_Input.Visible = false;
        BXieban_Input.Visible = false;
        BIF_Input.Visible = false; 
        
        }

        /// <summary>
        /// 隐藏显示框
        /// </summary>
        private void Hidden_Disp()
        { 
        TID_Disp.Visible = false;
        ALaiyuan_Disp.Visible = false;
        AzhuanbanID_Disp.Visible = false;
        AzhuanfangTime_Disp.Visible = false;
        ALiFangname_Disp.Visible = false;
        ALaifangTime_Disp.Visible = false;
        AID_Disp.Visible = false;
        APhone_Disp.Visible = false;
        AlaifangGroup_Disp.Visible = false;
        Alaifangzhuzhi_Disp.Visible = false;
        Alaifangpostcode_Disp.Visible = false;
        Abeitousudanw_Disp.Visible = false;
        AbeitousuName_Disp.Visible = false;
        Afanyingwenti_Disp.Visible = false;
        AdiyiciTime_Disp.Visible = false;
        Asunshi_Disp.Visible = false;
        Azhinengbumen_Disp.Visible = false;
        ATimeAndGroup_Disp.Visible = false;
        AfanyingTime_Disp.Visible = false;
        Achuliqingkuang_Disp.Visible = false;
        ADafu_Disp.Visible = false;
        AShenqingfucha_Disp.Visible = false;
        AfuchaTime_Disp.Visible = false;
        AShiyijian_Disp.Visible = false;
        Axinfangbanyijian_Disp.Visible = false;
        AlingdaoYijian_Disp.Visible = false;
        Azhuanchu_Disp.Visible = false;
        AzhuanchuTime_Disp.Visible = false;
        AyaoqiuTime_Disp.Visible = false;
        Ajieguo_Disp.Visible = false;
        Ajiluren_Disp.Visible = false;
        AjilushiTime_Disp.Visible = false;
        Afujian_Disp.Visible = false;
        BWentiType_Disp.Visible = false;
        BXianCon_Disp.Visible = false;
        BXinfang_Disp.Visible = false;
        BLingdao_Disp.Visible = false;
        BSumDay_Disp.Visible = false; 
        BChuliGroup_Disp.Visible = false;
        BChaoSong_Disp.Visible = false;
        BXieban_Disp.Visible = false;
        BIF_Disp.Visible = false;
       
        
        }

        /// <summary>
        /// 增加/修改事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            string Type_Value = "来信";
            string TID_Value = (string)Common.sink(TID_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string ALaiyuan_Value = (string)Common.sink(ALaiyuan_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string AzhuanbanID_Value = (string)Common.sink(AzhuanbanID_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);

            DateTime? AzhuanfangTime_Value = (DateTime?)Common.sink(AzhuanfangTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string ALiFangname_Value = (string)Common.sink(ALiFangname_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);

            DateTime? ALaifangTime_Value = (DateTime?)Common.sink(ALaifangTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string AID_Value = (string)Common.sink(AID_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string APhone_Value = (string)Common.sink(APhone_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string AlaifangGroup_Value = (string)Common.sink(AlaifangGroup_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Alaifangzhuzhi_Value = (string)Common.sink(Alaifangzhuzhi_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Alaifangpostcode_Value = (string)Common.sink(Alaifangpostcode_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Abeitousudanw_Value = (string)Common.sink(Abeitousudanw_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string AbeitousuName_Value = (string)Common.sink(AbeitousuName_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Afanyingwenti_Value = (string)Common.sink(Afanyingwenti_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AdiyiciTime_Value = (DateTime?)Common.sink(AdiyiciTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string Asunshi_Value = (string)Common.sink(Asunshi_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Azhinengbumen_Value = (string)Common.sink(Azhinengbumen_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string ATimeAndGroup_Value = (string)Common.sink(ATimeAndGroup_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AfanyingTime_Value = (DateTime?)Common.sink(AfanyingTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string Achuliqingkuang_Value = (string)Common.sink(Achuliqingkuang_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string ADafu_Value = (string)Common.sink(ADafu_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string AShenqingfucha_Value = (string)Common.sink(AShenqingfucha_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AfuchaTime_Value = (DateTime?)Common.sink(AfuchaTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string AShiyijian_Value = (string)Common.sink(AShiyijian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Axinfangbanyijian_Value = (string)Common.sink(Axinfangbanyijian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string AlingdaoYijian_Value = (string)Common.sink(AlingdaoYijian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Azhuanchu_Value = (string)Common.sink(Azhuanchu_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AzhuanchuTime_Value = (DateTime?)Common.sink(AzhuanchuTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string AyaoqiuTime_Value = (string)Common.sink(AyaoqiuTime_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Ajieguo_Value = (string)Common.sink(Ajieguo_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Ajiluren_Value = (string)Common.sink(Ajiluren_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AjilushiTime_Value = (DateTime?)Common.sink(AjilushiTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string Afujian_Value = (string)Common.sink(Afujian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
           
            T_TouSuEntity ut = BusinessFacadeModel.T_TouSuDisp(IDX);

            ut.Type = Type_Value;
            ut.TID = TID_Value;
            ut.ALaiyuan = ALaiyuan_Value;
            ut.AzhuanbanID = AzhuanbanID_Value;
            ut.AzhuanfangTime = AzhuanfangTime_Value;
            ut.ALiFangname = ALiFangname_Value;
            ut.ALaifangTime = ALaifangTime_Value;
            ut.AID = AID_Value;
            ut.APhone = APhone_Value;
            ut.AlaifangGroup = AlaifangGroup_Value;
            ut.Alaifangzhuzhi = Alaifangzhuzhi_Value;
            ut.Alaifangpostcode = Alaifangpostcode_Value;
            ut.Abeitousudanw = Abeitousudanw_Value;
            ut.AbeitousuName = AbeitousuName_Value;
            ut.Afanyingwenti = Afanyingwenti_Value;
            ut.AdiyiciTime = AdiyiciTime_Value;
            ut.Asunshi = Asunshi_Value;
            ut.Azhinengbumen = Azhinengbumen_Value;
            ut.ATimeAndGroup = ATimeAndGroup_Value;
            ut.AfanyingTime = AfanyingTime_Value;
            ut.Achuliqingkuang = Achuliqingkuang_Value;
            ut.ADafu = ADafu_Value;
            ut.AShenqingfucha = AShenqingfucha_Value;
            ut.AfuchaTime = AfuchaTime_Value;
            ut.AShiyijian = AShiyijian_Value;
            ut.Axinfangbanyijian = Axinfangbanyijian_Value;
            ut.AlingdaoYijian = AlingdaoYijian_Value;
            ut.Azhuanchu = Azhuanchu_Value;
            ut.AzhuanchuTime = AzhuanchuTime_Value;
            ut.AyaoqiuTime = AyaoqiuTime_Value;
            ut.Ajieguo = Ajieguo_Value;
            ut.Ajiluren = Ajiluren_Value;
            ut.AjilushiTime = AjilushiTime_Value;
            ut.Afujian = Afujian_Value;
            
            if (CMD == "New")
            {
                ut.DataTable_Action_ = DataTable_Action.Insert;
            }
            else if (CMD == "Edit")
            {
                ut.DataTable_Action_ = DataTable_Action.Update;
            }
            else
            {
                EventMessage.MessageBox(2, "不存在操作字符串!", "不存在操作字符串!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
            }
            Int32 rInt = BusinessFacadeModel.T_TouSuInsertUpdateDelete(ut);
            if (rInt > 0)
            {
                string OpTxt = string.Format("增加办理成功!(ID:{0})", rInt);
                if (ut.DataTable_Action_ == DataTable_Action.Update)
                    OpTxt = string.Format("修改办理成功!(ID:{0})", IDX);
                EventMessage.MessageBox(1, "操作成功", OpTxt, Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
            }
            else if (rInt == -2)
            {
                EventMessage.MessageBox(1, "操作失败", "操作失败,存在相同的键值(用户名/数据)!", Icon_Type.Alert, Common.GetHomeBaseUrl("Default.aspx"));
            }
            else
            {
                EventMessage.MessageBox(1, "操作失败", string.Format("操作失败,返回值:{0}!", rInt), Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
            }
        
        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            string Type_Value = "来信";
            string TID_Value = (string)Common.sink(TID_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string ALaiyuan_Value = (string)Common.sink(ALaiyuan_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string AzhuanbanID_Value = (string)Common.sink(AzhuanbanID_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);

            DateTime? AzhuanfangTime_Value = (DateTime?)Common.sink(AzhuanfangTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string ALiFangname_Value = (string)Common.sink(ALiFangname_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);

            DateTime? ALaifangTime_Value = (DateTime?)Common.sink(ALaifangTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string AID_Value = (string)Common.sink(AID_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string APhone_Value = (string)Common.sink(APhone_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string AlaifangGroup_Value = (string)Common.sink(AlaifangGroup_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Alaifangzhuzhi_Value = (string)Common.sink(Alaifangzhuzhi_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Alaifangpostcode_Value = (string)Common.sink(Alaifangpostcode_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Abeitousudanw_Value = (string)Common.sink(Abeitousudanw_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string AbeitousuName_Value = (string)Common.sink(AbeitousuName_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Afanyingwenti_Value = (string)Common.sink(Afanyingwenti_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AdiyiciTime_Value = (DateTime?)Common.sink(AdiyiciTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string Asunshi_Value = (string)Common.sink(Asunshi_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Azhinengbumen_Value = (string)Common.sink(Azhinengbumen_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string ATimeAndGroup_Value = (string)Common.sink(ATimeAndGroup_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AfanyingTime_Value = (DateTime?)Common.sink(AfanyingTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string Achuliqingkuang_Value = (string)Common.sink(Achuliqingkuang_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string ADafu_Value = (string)Common.sink(ADafu_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string AShenqingfucha_Value = (string)Common.sink(AShenqingfucha_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AfuchaTime_Value = (DateTime?)Common.sink(AfuchaTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string AShiyijian_Value = (string)Common.sink(AShiyijian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Axinfangbanyijian_Value = (string)Common.sink(Axinfangbanyijian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string AlingdaoYijian_Value = (string)Common.sink(AlingdaoYijian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Azhuanchu_Value = (string)Common.sink(Azhuanchu_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AzhuanchuTime_Value = (DateTime?)Common.sink(AzhuanchuTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string AyaoqiuTime_Value = (string)Common.sink(AyaoqiuTime_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Ajieguo_Value = (string)Common.sink(Ajieguo_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Ajiluren_Value = (string)Common.sink(Ajiluren_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AjilushiTime_Value = (DateTime?)Common.sink(AjilushiTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string Afujian_Value = (string)Common.sink(Afujian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BWentiType_Value = (string)Common.sink(BWentiType_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BXianCon_Value = (string)Common.sink(BXianCon_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BXinfang_Value = (string)Common.sink(BXinfang_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BLingdao_Value = (string)Common.sink(BLingdao_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BSumDay_Value = (string)Common.sink(BSumDay_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

             
            Int32 BChuliGroup_Value = (Int32)Common.sink(BChuliGroup_Input.UniqueID, MethodType.Post, 500, 0, DataType.Int);
            string BChaoSong_Value = (string)Common.sink(BChaoSong_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BXieban_Value = (string)Common.sink(BXieban_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BIF_Value = (string)Common.sink(BIF_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);


            T_TouSuEntity ut = BusinessFacadeModel.T_TouSuDisp(IDX);

            ut.Type = Type_Value;
            ut.TID = TID_Value;
            ut.ALaiyuan = ALaiyuan_Value;
            ut.AzhuanbanID = AzhuanbanID_Value;
            ut.AzhuanfangTime = AzhuanfangTime_Value;
            ut.ALiFangname = ALiFangname_Value;
            ut.ALaifangTime = ALaifangTime_Value;
            ut.AID = AID_Value;
            ut.APhone = APhone_Value;
            ut.AlaifangGroup = AlaifangGroup_Value;
            ut.Alaifangzhuzhi = Alaifangzhuzhi_Value;
            ut.Alaifangpostcode = Alaifangpostcode_Value;
            ut.Abeitousudanw = Abeitousudanw_Value;
            ut.AbeitousuName = AbeitousuName_Value;
            ut.Afanyingwenti = Afanyingwenti_Value;
            ut.AdiyiciTime = AdiyiciTime_Value;
            ut.Asunshi = Asunshi_Value;
            ut.Azhinengbumen = Azhinengbumen_Value;
            ut.ATimeAndGroup = ATimeAndGroup_Value;
            ut.AfanyingTime = AfanyingTime_Value;
            ut.Achuliqingkuang = Achuliqingkuang_Value;
            ut.ADafu = ADafu_Value;
            ut.AShenqingfucha = AShenqingfucha_Value;
            ut.AfuchaTime = AfuchaTime_Value;
            ut.AShiyijian = AShiyijian_Value;
            ut.Axinfangbanyijian = Axinfangbanyijian_Value;
            ut.AlingdaoYijian = AlingdaoYijian_Value;
            ut.Azhuanchu = Azhuanchu_Value;
            ut.AzhuanchuTime = AzhuanchuTime_Value;
            ut.AyaoqiuTime = AyaoqiuTime_Value;
            ut.Ajieguo = Ajieguo_Value;
            ut.Ajiluren = Ajiluren_Value;
            ut.AjilushiTime = AjilushiTime_Value;
            ut.Afujian = Afujian_Value;
            ut.BWentiType = BWentiType_Value;
            ut.BXianCon = BXianCon_Value;
            ut.BXinfang = BXinfang_Value;
            ut.BLingdao = BLingdao_Value;
            ut.BSumDay = BSumDay_Value; 
            ut.BChuliGroup = BChuliGroup_Value;
            ut.BChaoSong = BChaoSong_Value;
            ut.BXieban = BXieban_Value;
            ut.BIF = BIF_Value;
            if (CMD == "New")
            {
                ut.DataTable_Action_ = DataTable_Action.Insert;
            }
            else if (CMD == "Edit")
            {
                ut.DataTable_Action_ = DataTable_Action.Update;
            }
            else
            {
                EventMessage.MessageBox(2, "不存在操作字符串!", "不存在操作字符串!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
            }
            Int32 rInt = BusinessFacadeModel.T_TouSuInsertUpdateDelete(ut);
            if (rInt > 0)
            {
                string OpTxt = string.Format("增加来信办理成功!(ID:{0})", rInt);
                if (ut.DataTable_Action_ == DataTable_Action.Update)
                    OpTxt = string.Format("修改来信办理成功!(ID:{0})", IDX);
                EventMessage.MessageBox(1, "操作成功", OpTxt, Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
            }
            else if (rInt == -2)
            {
                EventMessage.MessageBox(1, "操作失败", "操作失败,存在相同的键值(用户名/数据)!", Icon_Type.Alert, Common.GetHomeBaseUrl("Default.aspx"));
            }
            else
            {
                EventMessage.MessageBox(1, "操作失败", string.Format("操作失败,返回值:{0}!", rInt), Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
            }
        }
    }
}
